iT邦幫忙

2022 iThome 鐵人賽

DAY 26
0
IT管理

Azure開發者必備掌握的基本系列 第 26

Azure開發者必備掌握的基本_第26天_Azure Messaging Services

  • 分享至 

  • xImage
  •  

https://ithelp.ithome.com.tw/upload/images/20221008/20107452FTeB7tnG3J.png

Azure 提供了三項Messaging Services,可幫助在整個解決方案中傳遞事件或消息。這些服務是:

  1. Azure Event Grid
  2. Azure Event Hubs
  3. Azure Service Bus
    儘管它們有一些相似之處,但每種服務都是針對特定場景而設計的。

Event(事件) vs. message services(消息服務)
傳遞事件的服務和傳遞消息的服務之間有一個重要的區別。
Event(事件)
事件是條件或狀態更改的輕量級通知。
事件的發布者對事件的處理方式沒有任何期望。
事件的消費者決定如何處理通知。
事件可以是離散單元或系列的一部分。

一系列事件報告一個條件並且是可分析的。
這些事件是按時間順序排列的並且是相互關聯的。
消費者需要按順序排列的一系列事件來分析發生了什麼。

message services(消息服務)
消息是服務產生的原始數據,可以在其他地方使用或存儲。該消息包含觸發消息管道的數據。
消息的發布者對消費者如何處理消息有一個期望。
雙方之間存在合同。例如,發布者發送帶有原始數據的消息,並期望消費者從該數據創建文件並在工作完成時發送響應。

在導入Message Service之前(緊耦合系統)
https://ithelp.ithome.com.tw/upload/images/20221008/20107452h3C84N19pF.png

在導入Message Service之後(鬆耦合系統)
https://ithelp.ithome.com.tw/upload/images/20221008/2010745289Ra0tEPYM.png

例如,如果產品在放入購物車後價格發生了變化,價格變化的事件將由目錄微服務發布,然後由購物車以及訂單處理微服務消費。

https://ithelp.ithome.com.tw/upload/images/20221008/20107452o0NbI00vix.png
Service Bus
•代理消息通信模型
•應用程序的組件不直接通信,但而是通過中間隊列交換消息
•支持發布/訂閱,以及更高級的功能,如事務和會話

https://ithelp.ithome.com.tw/upload/images/20221008/20107452NYe0yoqbQD.png
Service Bus Queues
•消息發送到隊列並從隊列接收
•存儲消息,直到接收者無法接收它們
•解耦的發送者和接收者
•按 FIFO 順序處理消息
•支持一個或多個發件人

一個案例

https://ithelp.ithome.com.tw/upload/images/20221008/20107452ljnZsST4gn.png
•發件人向主題發送消息
•接收者從訂閱中接收
•每個訂閱都有一份消息副本
•訂閱支持過濾器、規則和操作
•每個訂閱最多 2000 條規則

Event Grid
•允許您輕鬆構建基於事件的應用程序架構
•事件網格專注於聲明的事件或消息
•該服務允許您發送消息,將它們路由到端點,並使用自定義代碼使用它們
•實現近乎實時的交付(通常不到一秒)規模(每秒數千個事件)
•消息大小最大為 64 KB
https://ithelp.ithome.com.tw/upload/images/20221008/20107452x9cuXe30cV.png

•Events: What happened.What happened. Examples: Storage blob added, IoT telemetry received

•Event sources: Where the event took place.Where the event happened. Examples: Storage
account, IOT Hub

•Topics: The endpoint where publishers send events. Where the event is sent. Used to group related events.

•Event subscriptions: The endpoint or built in mechanism to route events, sometimes to more than one handler Subscriptions are also used by handlers to intelligently filter incoming events.
Which events interest me. Examples: Storage blob added, IOT telemetry received.

•Event handlers: The app or service reacting to the event.Where the event is sent. Examples: Azure
Function, Event Hubs etc.

•Publisher: Who created the event. Examples: Microsoft, my organization

Event Hubs
•大數據流平台和事件攝取服務,每秒能夠接收和處理數百萬個事件
•處理和存儲由分佈式軟件和設備
•發送到事件中心的數據可以使用轉換和存儲任何實時分析提供程序或批處理/存儲適配器
https://ithelp.ithome.com.tw/upload/images/20221008/20107452QuxnyIJhZB.png

應用情境:
•Anomaly detection (fraud/outliers)
•Application logging
•Analytics pipelines, such as clickstreams
•Live dashboarding
•Archiving data
•Transaction processing
•User telemetry processing
•Device telemetry streaming

Event Grid vs Event Hubs vs Service Bus
https://ithelp.ithome.com.tw/upload/images/20221008/20107452RQUquqpkkq.png

Ref:
https://azure.microsoft.com/en-us/solutions/messaging-services/#products
https://learn.microsoft.com/en-us/azure/messaging-services/


上一篇
Azure開發者必備掌握的基本_第25天_API Management
下一篇
Azure開發者必備掌握的基本_第27天_Azure Service Bus實作
系列文
Azure開發者必備掌握的基本30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言